package com.cqut.forum.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * @author yangxun
 * Level entity
 * 用户权限表
 */
@Entity
@Table(name = "level", catalog = "forum")
public class Level implements java.io.Serializable {

	// Fields

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private Integer levelId;
	private User user;
	//private ModuleInformation moduleInformation;
	private Module module;

	// Constructors

	/** default constructor */
	public Level() {
	}

	/** full constructor */
	public Level(User user, /*ModuleInformation moduleInformation,*/ Module module) {
		this.user = user;
		//this.moduleInformation = moduleInformation;
		this.module = module;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "level_id", unique = true, nullable = false)
	public Integer getLevelId() {
		return this.levelId;
	}

	public void setLevelId(Integer levelId) {
		this.levelId = levelId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "user_id")
	public User getUser() {
		return this.user;
	}

	public void setUser(User user) {
		this.user = user;
	}

/*	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "module_information_id")
	public ModuleInformation getModuleInformation() {
		return this.moduleInformation;
	}

	public void setModuleInformation(ModuleInformation moduleInformation) {
		this.moduleInformation = moduleInformation;
	}*/

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "module_id")
	public Module getModule() {
		return this.module;
	}

	public void setModule(Module module) {
		this.module = module;
	}

}